using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;

namespace MyCollections.Utils
{
    class Data
    {
        public static string getMessage(string key)
        {
            return getMessage(key, System.Globalization.CultureInfo.CurrentCulture);
        }

        public static string getMessage(string key, System.Globalization.CultureInfo culture)
        {
            string r = Resources.Resource.ResourceManager.GetString(key, culture);
            return r;
        }

        public static ArrayList GenerateFileList(string Dir)
        {
            ArrayList fils = new ArrayList();
            bool Empty = true;
            if (Directory.Exists(Dir))
            {
                foreach (string file in Directory.GetFiles(Dir)) // add each file in directory
                {
                    fils.Add(file);
                    Empty = false;
                }

                if (Empty)
                {
                    if (Directory.GetDirectories(Dir).Length == 0)
                    // if directory is completely empty, add it
                    {
                        fils.Add(Dir + @"/");
                    }
                }

                foreach (string dirs in Directory.GetDirectories(Dir)) // recursive
                {
                    foreach (object obj in GenerateFileList(dirs))
                    {
                        fils.Add(obj);
                    }
                }
            }

            return fils; // return file list
        }
    }
}
